package com.example.composemodifiterdemo

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

/**
 *@author: njb
 *@date:  2023/2/8 16:39
 *@desc:
 */
class SpacerSampleActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            spacerSample()
        }
    }

    @Preview
    @Composable
    fun spacerSample() {
        Row() {
            Box(
                modifier = Modifier
                    .size(100.dp)
                    .background(Color.Red)
            )
            Spacer(modifier = Modifier.padding(20.dp))
            Box(
                modifier = Modifier
                    .size(100.dp)
                    .background(Color.Magenta)
            )
            Spacer(modifier = Modifier.padding(20.dp))
            Box(
                modifier = Modifier
                    .size(100.dp)
                    .background(Color.Black)
            )
        }
    }
}